import CryptoJS from "crypto-js";
import {
	Base64
}
from 'js-base64';
const a5e8a9c18f13de7338f5867cc7e0befd4 = CryptoJS.enc.Utf8.parse('f60f0e0ad26194d649a625e64d67ea6e');
const a9794102f7381d33f75e8acfe925a0c7 = CryptoJS.enc.Utf8.parse('1587824666852351');

function aesEncrypt(a) {
	var b = CryptoJS.AES.encrypt(a, a5e8a9c18f13de7338f5867cc7e0befd4, {
		iv: a9794102f7381d33f75e8acfe925a0c7,
		mode: CryptoJS.mode.CBC,
		padding: CryptoJS.pad.Pkcs7
	});
	return b
}
function aesDecrypt(a) {
	var b = CryptoJS.AES.decrypt(a, a5e8a9c18f13de7338f5867cc7e0befd4, {
		iv: a9794102f7381d33f75e8acfe925a0c7,
		mode: CryptoJS.mode.CBC,
		padding: CryptoJS.pad.Pkcs7
	});
	return b.toString(CryptoJS.enc.Utf8)
}
function base64dec(a) {
	return Base64.decode(a)
}
function base64enc(a) {
	return Base64.encode(a)
}
function enc(a) {
	if (typeof a == 'object') {
		a = JSON.stringify(a)
	}
	let str = aesEncrypt(a);
	return base64enc(str)
}
function dec(a) {
	return aesDecrypt(base64dec(a))
}
export
default {
	enc, dec, base64dec, base64enc, aesDecrypt, aesEncrypt
}